package com.currency.mall.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.currency.mall.R;
import com.currency.mall.entity.RechargeStatus;

import java.util.List;

/**
 * Created by Administrator on 2018/12/5.
 */

public class RechargeStatusAdapter extends BaseQuickAdapter<RechargeStatus, BaseViewHolder> {

    public RechargeStatusAdapter(@Nullable List<RechargeStatus> data, Context context) {
        super(R.layout.item_recharge_status, data);
    }

    @Override
    protected void convert(BaseViewHolder helper,RechargeStatus rechargeStatus) {
        TextView typeName = helper.getView(R.id.tv_type_name);
        if("ALIPAY".equals(rechargeStatus.getType())){  //充值
            typeName.setText("支付宝充值");
        }else if("BANK".equals(rechargeStatus.getType())){//提现
            typeName.setText("银行卡转账充值");
        }

        helper.setText(R.id.tv_time,rechargeStatus.getOrderTime());
        helper.setText(R.id.tv_price,"+ " +rechargeStatus.getRecharSum());
        TextView tvStatus = helper.getView(R.id.tv_status);
        if("PAY_OPERATION".equals(rechargeStatus.getStatus())){  //充值
            tvStatus.setText("充值中");
        }else if("PAY_SUCCESS".equals(rechargeStatus.getStatus())){//提现
            tvStatus.setText("充值成功");
        }else if("PAY_ERROR".equals(rechargeStatus.getStatus())){//提现
            tvStatus.setText("充值失败");
        }else if("PAY_WAIT".equals(rechargeStatus.getStatus())){//提现
            tvStatus.setText("等待付款");
        }else if("PAY_CANCEL".equals(rechargeStatus.getStatus())){//提现
            tvStatus.setText("取消充值");
        }

    }

}
